Skip to content

add audit_cert_parent_parity CLI command#299

Draft
maperu wants to merge 1 commit into
masterfrom
maperu/auditCertParentParity
Draft

add audit_cert_parent_parity CLI command#299
maperu wants to merge 1 commit into
masterfrom
maperu/auditCertParentParity

Conversation

@maperu

@maperu maperu commented Jun 12, 2026

Copy link
Copy Markdown

Adds a new CLI command audit_cert_parent_parity that walks every valid cert with a replaces relationship, compares its destinations/sources/endpoints with the parent's, and emits a metric per mismatch. The metric is tagged with cert_id, parent_cert_id, owner, and mismatch_type so a Datadog monitor can route the alert to the cert owner.

Parity violations usually indicate a botched rotation, source-sync drift, or a manual override that left the cert in an inconsistent state. Today this surfaces as expiry-monitor noise that the Lemur team has to untangle by hand. With this metric in place we can route directly to the cert owner.

Modeled on the existing check_revoked CLI command pattern in the same file. Uses session_query + paginate for large fleets.

This is half of a two-part change:

  • This PR: emit the metric from Lemur (CLI command + paginated audit)
  • k8s-resources PR (separate): wire the command into the celery beat schedule so it runs daily
  • terraform-config PR (separate): add the datadog_monitor resource over the resulting metric

The function is exposed as a Flask-Script manager command but doesn't run on its own yet, so this PR is safe to merge before the schedule entry is in place.

Verifying locally: run lemur audit_cert_parent_parity in a pod and check the metric appears in Datadog at lemur.certificate_parent_parity_violation.

For each valid cert that replaces an older one, compare its
destinations, sources, and endpoints with the parent's and emit a
metric per mismatch. The metric carries the cert_id, parent_cert_id,
owner, and mismatch_type tags so a Datadog monitor can route the alert
to the cert owner.

Parity violations usually indicate a botched rotation, source-sync
drift, or a manual override that left the cert in an inconsistent
state — the kind of thing the Lemur team currently has to untangle
by hand whenever it surfaces in expiry-monitor noise.

Half of a two-part change. The celery beat schedule entry that drives
this daily lives in k8s-resources (per the CLAUDE.md convention) and
goes in a separate PR. The Datadog monitor over the resulting metric
goes in terraform-config (also separate PR).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant