Faberby FaberOps

TLS Certificate Expiry Signature

Matches expired or untrusted certificate errors in logs, cert-manager Certificates that are not Ready, and certificates close to expiry.

Kind
Signature
Version
2.0.0
Tier
verified
Needs Faber
v2.0.0+
Digest prefix
sha256:52af2c97

Contract facts

Sources
4
kubernetes, loki, prometheus, victorialogs
Log patterns
5
RE2, replayed in CI
Kubernetes matchers
2
CEL on live objects
Samples
4 and 3
must match and must not

Inspect it

Inspect the contract and RBAC delta

$ faberctl catalog inspect signatures/tls-cert-expiry \ --source oci://ghcr.io/faberops/catalog:v2

How it works

  • Sources: kubernetes, loki, prometheus, victorialogs
  • Log patterns: 5 RE2 expressions, each proven by the samples.match and samples.noMatch lines that catalog CI replays
  • Ready queries: victorialogs, loki, promql

Use from a Playbook

Reference the pack by name from a connector trigger:

YAML7 lines
triggers:
  - name: signature-hit
    connector:
      connectorType: loki
      signaturePack: tls-cert-expiry
      window: 10m
      minMatches: 3

Signatures only describe what to look for. They never grant a Playbook any permission or action.

What it matches

Must match

  • Get https://api.example.com: x509: certificate has expired or is not yet valid
  • remote error: tls: bad certificate
  • SSL_ERROR_EXPIRED_CERT
  • [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired

Must not match

  • TLS handshake complete with TLS 1.3
  • certificate renewed, next renewal in 60 days
  • Issuing certificate as Secret does not exist

Signature source

signature.yamlFailureSignature38 lines
apiVersion: catalog.faberops.dev/v2
kind: FailureSignature
metadata:
  name: tls-cert-expiry
spec:
  description: Matches expired or untrusted certificate errors in logs, cert-manager Certificates that are not Ready, and certificates close to expiry.
  sources:
    - kubernetes
    - loki
    - prometheus
    - victorialogs
  logPatterns:
    - '(?i)x509: certificate has expired'
    - '(?i)certificate has expired or is not yet valid'
    - '(?i)tls: bad certificate'
    - 'SSL_ERROR_EXPIRED_CERT'
    - '(?i)certificate verify failed'
  queries:
    victorialogs: '("x509: certificate has expired" OR "certificate has expired or is not yet valid" OR "tls: bad certificate" OR "certificate verify failed")'
    loki: '{namespace=~".+"} |~ "(?i)(x509: certificate has expired|not yet valid|tls: bad certificate|certificate verify failed)"'
    promql: '(certmanager_certificate_expiration_timestamp_seconds - time()) < 14 * 24 * 3600'
  kubernetes:
    - apiVersion: cert-manager.io/v1
      kind: Certificate
      match: 'has(object.status.conditions) && object.status.conditions.exists(c, c.type == "Ready" && c.status == "False")'
    - apiVersion: external-secrets.io/v1
      kind: ExternalSecret
      match: 'has(object.status.conditions) && object.status.conditions.exists(c, c.type == "Ready" && c.status == "False")'
  samples:
    match:
      - 'Get https://api.example.com: x509: certificate has expired or is not yet valid'
      - 'remote error: tls: bad certificate'
      - 'SSL_ERROR_EXPIRED_CERT'
      - '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired'
    noMatch:
      - 'TLS handshake complete with TLS 1.3'
      - 'certificate renewed, next renewal in 60 days'
      - 'Issuing certificate as Secret does not exist'
pack.yamlcatalog metadata11 lines
# Catalog metadata for signatures/tls-cert-expiry. Not applied to the cluster.
apiVersion: catalog.faberops.dev/v2
kind: CatalogPack
metadata:
  name: tls-cert-expiry
  category: signatures
  version: 2.0.0
spec:
  tier: verified
  minFaberVersion: v2.0.0
  digest: sha256:52af2c973289a78bfde7ec0c238086b3ca7d7153dd4ca4a11055be795fa02bae

Signatures are catalog data. A Playbook references one by name in a connector trigger. It is never applied on its own.