Schedule icon
Request icon
Script icon
Docker icon
Switch icon
SlackIncomingWebhook icon
Log icon
OutputValues icon

Smallstep step-ca Certificate Expiry & Authority Health Sentinel

Audit Smallstep step-ca daemon health, monitor root X.509 certificate expiration horizons, and dispatch automated Slack alerts before mTLS outages occur.

Categories
Infrastructure

Smallstep step-ca is an open-source, automated private Certificate Authority (CA) used by DevOps and platform teams to issue mTLS identity certificates, manage internal Zero Trust PKI, and automate short-lived certificate lifecycles across Kubernetes clusters and microservices. However, if the CA daemon encounters an unhandled crash, or if the underlying root or intermediate X.509 certificates expire without renewal, all downstream service authentication, mTLS encryption handshakes, and automated certificate rotations fail simultaneously across the entire infrastructure.

This blueprint provides an automated sentinel that periodically probes Smallstep step-ca daemon health, retrieves active root certificate chains over the public authority endpoint, calculates the exact days remaining until certificate expiration, classifies operational risk through a conditional Switch gate, dispatches context-rich Slack incident alerts, and exports structured PKI telemetry for security compliance auditing.

How it works

  1. scheduled_pki_audit (io.kestra.plugin.core.trigger.Schedule) initiates automated surveillance every six hours. It is shipped disabled by default for initial connection verification.
  2. probe_ca_health (io.kestra.plugin.core.http.Request) invokes the Smallstep CA endpoint GET /health to confirm that the PKI daemon process is running and accepting client requests.
  3. probe_root_certificates (io.kestra.plugin.scripts.python.Script running inside Docker) fetches the active root certificate bundle from GET /roots, parses the X.509 validity boundaries using Python's cryptography library, and computes the exact days remaining until expiration against UTC timestamps.
  4. classify_certificate_health (io.kestra.plugin.core.flow.Switch) evaluates the calculated days remaining against team risk tolerances:
    • CRITICAL_EXPIRY_RISK: Triggered when days remaining falls below critical_days_threshold (default 15 days). Dispatches an urgent incident card to #security-pki via io.kestra.plugin.slack.notifications.SlackIncomingWebhook containing the certificate subject, serial number, expiration timestamp, and CA rotation runbook guidance.
    • EXPIRY_WARNING: Triggered when validity falls below warning_days_threshold (default 45 days). Sends an advisory Slack message to schedule routine provisioner renewal.
    • HEALTHY: Logs nominal validity status via io.kestra.plugin.core.log.Log when certificates are well within operating parameters.
  5. finalize_pki_audit (io.kestra.plugin.core.output.OutputValues) publishes clean telemetry (subject, issuer, validity window, days remaining, daemon status) for compliance reporting and long-term monitoring dashboards.
  6. The global errors handler captures connection timeouts, unreachable endpoints, or crashed daemon states to alert the PKI operations team out-of-band.

What you get

  • Early detection of impending root and intermediate CA expiration before microservice mTLS handshakes break.
  • Continuous verification of CA daemon uptime and HTTP endpoint availability.
  • Formatted Slack alert cards with exact expiration timestamps, subject identifiers, and actionable runbook steps.
  • Centralized audit records in Kestra to satisfy SOC 2, ISO 27001, and NIST Zero Trust cryptographic requirements.

Who it's for

  • Platform Engineers and Site Reliability Engineers (SREs) operating internal PKI and Zero Trust service meshes.
  • Security Operations (SecOps) teams responsible for cryptographic key governance and certificate lifecycle auditing.
  • DevOps engineers running automated ACME or mTLS workloads with Smallstep step-ca.

Why orchestrate this with Kestra

Certificate Authority outages cause catastrophic ripple effects across distributed systems. Standalone monitoring scripts or cron tasks lack persistent execution histories, centralized audit logs, secret masking, and robust error recovery. Kestra provides declarative scheduling, containerized cryptographic parsing, conditional alerting logic, and enterprise collaboration integrations out of the box.

Prerequisites

  • A running instance of Smallstep step-ca, reachable over HTTP or HTTPS. Smallstep publishes an official open-source Docker image (smallstep/step-ca:latest) requiring no paid license or commercial account.
  • An incoming Slack webhook configured for PKI alerts.
  • Docker enabled on Kestra workers to execute the Python cryptographic probe container.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch operational and security alerts.

Quick start

  1. Start a local Smallstep CA container:
    docker run -d --name step-ca-sentinel -p 9000:9000 -e DOCKER_STEPCA_INIT_NAME="Internal PKI" -e DOCKER_STEPCA_INIT_DNS_NAMES="localhost" smallstep/step-ca:latest
    
  2. Configure SLACK_WEBHOOK_URL in your Kestra namespace secrets.
  3. Import this blueprint into Kestra under namespace company.security.
  4. Click Execute with default parameters (stepca_url: https://localhost:9000) to confirm connectivity and view root certificate validity metrics.
  5. Enable scheduled_pki_audit to activate continuous six-hour PKI surveillance.

How to extend

  • Add automated provisioner rotation: invoke the step-cli container task to execute step ca renew automatically when intermediate validity enters warning status.
  • Integrate with PagerDuty via io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for Sev-1 paging when root CA validity drops below 7 days.
  • Export certificate expiration metrics to Prometheus via io.kestra.plugin.prometheus.PushGateway for visualization on Grafana infrastructure dashboards.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.