Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Pinniped Supervisor JWT Authenticator Clock Skew Sentinel

Scrapes Pinniped Supervisor metrics to detect JWT authenticator clock skew, token validation failures, and auth stalls.

Categories
CloudInfrastructure

Automates continuous identity federation surveillance for Pinniped Supervisor deployments across Kubernetes clusters. The workflow audits Prometheus metrics to detect JWT authenticator clock skew, cryptographic token rejection spikes, and upstream OIDC JWKS public key rotation stalls before enterprise developers lose cluster access.

How it works

  1. A schedule trigger executes the Pinniped Supervisor audit workflow every 15 minutes.
  2. The Python task queries the Pinniped Supervisor metrics endpoint on port 8080.
  3. The script extracts observed clock skew seconds, rejected token counts, and JWKS key set sync error totals.
  4. An evaluation gate determines whether clock skew or authentication rejection rates exceed enterprise thresholds.
  5. When authentication drift or signature verification failures occur, a high-priority Slack incident alert is dispatched.
  6. When user tokens validate smoothly against upstream IdP endpoints, nominal metrics are recorded in logs.
  7. A structured JSON audit manifest is emitted for identity governance and security compliance archives.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 15m] --> ScanMetrics[Python Script: Scrape Pinniped Metrics]
    ScanMetrics --> EvalBreach{Skew > 60s OR Rejections > 5 OR JWKS Errors > 0?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency IAM Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal Pinniped State]
    SlackAlert --> EmitManifest[Debug Return: Identity Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 15-minute recurring intervals.
  • Script Task: Scrapes Pinniped Supervisor Prometheus metrics using Docker container runners.
  • Decision Gate: Evaluates whether observed clock skew or token rejection counts exceed limits.
  • Notification Task: Dispatches structured Slack alerts with affected issuer URLs and drift statistics.
  • Audit Manifest: Emits JSON execution payloads containing identity health and timestamps.

Key capabilities

  • Continuous surveillance of Pinniped JWTAuthenticator and OIDCIdentityProvider custom resources.
  • Early warning detection for NTP clock drift between Kubernetes nodes and external Okta/Azure AD IdPs.
  • Automated tracking of JWKS key rotation delays causing valid bearer tokens to be rejected.
  • Zero host dependency execution via isolated containerized Python runners.

What you get

  • Real-time visibility into Kubernetes unified enterprise identity federation and single sign-on health.
  • Proactive alerts preventing developer lockout from kubectl during IdP certificate renewals.
  • Standardized audit manifests containing exact clock drift measurements and token rejection tallies.
  • Zero-overhead deployment compatible with Pinniped Concierge and Supervisor on any Kubernetes cluster.

Who it's for

  • Identity and Access Management (IAM) SecOps teams managing enterprise Kubernetes authentication.
  • Security architects enforcing strict multi-factor authentication and token lifecycle policies.
  • Site Reliability Engineers ensuring continuous availability of cluster control plane access.
  • Platform engineers integrating corporate identity providers (Okta, Keycloak, Ping, Entra ID).

Why orchestrate this with Kestra

  • Serverless Docker Isolation: Executes telemetry scraping in ephemeral Docker environments without persistent workers.
  • Centralized Secrets Governance: Protects sensitive Slack webhooks using encrypted namespace secrets.
  • Declarative YAML Workflows: Manages identity security surveillance as versioned code in Git repositories.
  • Comprehensive Audit History: Preserves historical authentication audit trails in searchable Kestra execution logs.

Use cases

  • Kubernetes Node NTP Drift: Catches hypervisor or VM clock drift that invalidates JWT nbf and exp claims.
  • Upstream IdP Key Rotation: Detects when Pinniped cannot fetch new public keys following IdP certificate renewal.
  • Brute Force Detection: Flags abnormal spikes in rejected bearer tokens indicating credential abuse attempts.

Inputs

Name Type Default Description
supervisor_metrics_url STRING http://pinniped-supervisor.pinniped-supervisor.svc.cluster.local:8080 Internal HTTP URL exposing Prometheus metrics for Pinniped.
target_jwt_issuer STRING https://auth.company.internal Upstream OIDC identity provider issuer URL monitored.
max_clock_skew_seconds_threshold INT 60 Maximum allowable clock skew in seconds before alerting.
max_token_rejection_count INT 5 Maximum allowable rejected JWT tokens before alerting.
alert_on_jwks_refresh_failure BOOL true Toggle whether JWKS key set sync errors trigger an alert.

Expected outputs

  • {{ outputs.scan_pinniped_telemetry.vars.clock_skew_seconds }}: Measured clock skew drift in seconds against the issuer.
  • {{ outputs.scan_pinniped_telemetry.vars.token_rejections_total }}: Total count of rejected bearer authentication tokens.
  • {{ outputs.scan_pinniped_telemetry.vars.jwks_sync_errors_total }}: Count of JWKS public key retrieval failures.
  • {{ outputs.scan_pinniped_telemetry.vars.is_alerting }}: Boolean flag indicating if identity bounds are breached.
  • {{ outputs.scan_pinniped_telemetry.vars.audit_timestamp }}: ISO-8601 UTC timestamp of the Pinniped audit run.

Prerequisites

  • Pinniped Supervisor installed with Prometheus metrics enabled on port 8080.
  • Network connectivity from the Kestra worker to the Pinniped Supervisor service.
  • Configured Slack incoming webhook URL with permissions to post in IAM SecOps alert channels.

Secrets

  • SLACK_WEBHOOK_URL: Secure webhook URL for routing IAM alerts to the SecOps Slack channel.

Quick start

  1. Verify that Pinniped Supervisor exposes Prometheus metrics on HTTP port 8080.
  2. Add the SLACK_WEBHOOK_URL secret within your Kestra namespace settings.
  3. Specify your target identity provider issuer URL in target_jwt_issuer.
  4. Run a manual flow execution via the Kestra UI to validate metric ingestion.
  5. Enable the periodic_pinniped_audit schedule trigger to establish automated monitoring.

Common pitfalls and troubleshooting

  • Issuer Claim Mismatch: If iss claim in incoming JWT does not match issuer exactly, tokens are discarded.
  • Egress Proxy TLS Interception: Corporate firewalls re-signing HTTPS traffic break JWKS signature validation.
  • Audience Validation Error: Tokens lacking configured aud audience claim fail authentication silently.
  • NTP Daemon Stoppage: Worker nodes without chronyd or systemd-timesyncd drift over time, causing skew.

How to extend

  • Automated JWKS Cache Flush: Trigger Kestra task to restart supervisor pods to force immediate JWKS cache reload.
  • PagerDuty Escalation: Escalate to on-call IAM engineers if token rejections exceed 50 in 15 minutes.
  • Multi-IdP Fleet Scan: Expand script parameters to monitor all declared JWTAuthenticator resources.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.