Schedule icon
Script icon
Process icon
If icon
SlackIncomingWebhook icon
Create icon
Pause icon
Log icon
Fail icon

Break-Glass Privileged Account Use Watchdog

Daily watchdog for break-glass privileged accounts: classify every use against approval records, alert on unapproved use, and fail closed so a broken check never reads as clean.

Categories
Infrastructure

What it does

Break-glass accounts exist for emergencies, which makes their use the highest-signal event in an audit log and the easiest to miss when nobody is watching. This blueprint watches a list of break-glass privileged accounts and classifies every one of their uses against an approval record. A use is approved only when an approval record names the same account and its validity window covers the event time. Every other break-glass use (no approval record, an expired window, a window that has not started yet, or an event that cannot be attributed to an account) is unapproved: the flow alerts Slack with the details, opens a GitHub incident issue naming who used which account and when, and pauses for a reviewer to confirm the use was expected. Only a reviewer confirmation lets the run complete; anything else fails it, so unapproved privileged use can never read as a passing check. In production the audit events and approval records are fetched from real feed URLs on each run, not pasted in as JSON. A failure of the watchdog itself alerts Slack separately, so a broken check never reads as a clean bill of health. The flow changes nothing in the audited system; it is audit-only.

Prerequisites

  • A list of break-glass privileged account names (the break_glass_accounts input).
  • Audit events as a JSON array (audit_events_json), each event with an account, an ISO 8601 timestamp, and an action. In production, point audit_events_url at a real audit feed export (a cloud audit log export or an identity provider audit export) instead; the JSON input and the bundled demo data are for first runs only.
  • Approval records as a JSON array (approvals_json), each record with an account, a valid_from timestamp, and a valid_until timestamp, plus ticket and approver for traceability. In production, point approvals_url at the approval records export instead.
  • A Slack incoming webhook URL stored as the SLACK_WEBHOOK_URL secret for the security channel.
  • A GitHub token stored as the GITHUB_TOKEN secret with issue-write scope on github_repository, for the incident issue.

How it works

  1. daily_break_glass_watch (io.kestra.plugin.core.trigger.Schedule) runs the check daily at 08:00 UTC. It ships disabled; enable it once the feed URLs point at real feeds and a manual run has been verified.
  2. fetch_real_feeds (io.kestra.plugin.scripts.python.Script) fetches the audit events and approval records from audit_events_url and approvals_url when those inputs are set, and passes the JSON inputs through unchanged when they are empty. A set URL that cannot be fetched fails the task, so a broken feed can never silently fall back to demo data.
  3. evaluate_break_glass_use (io.kestra.plugin.scripts.python.Script) parses the accounts, events, and approvals, then classifies each break-glass use. Approval requires an exact account match and an event time inside the validity window. Malformed or unattributable events count as unapproved (fail closed). It emits total_uses, approved_uses, unapproved_uses, unapproved_details, and verdict through Kestra.outputs.
  4. alert_on_unapproved_use (io.kestra.plugin.core.flow.If) branches on unapproved_uses > 0. On the alert branch, alert_security_channel posts the count and details to Slack, open_incident opens a GitHub incident issue naming who used which account and when, and pause_for_reviewer_confirmation (io.kestra.plugin.core.flow.Pause) waits for a reviewer to confirm the use was expected. confirm_or_fail completes the run only on a reviewer confirmation (the incident stays open as the audit record); anything else runs fail_on_unapproved_use and the execution fails. On a clean run, log_clean_verdict records the verdict.
  5. log_watchdog_complete runs last on clean and reviewer-confirmed runs and prints the headline counts. The errors block posts to Slack if the watchdog itself fails.
  6. The bundled demo data yields 3 break-glass uses (1 approved, 2 unapproved) plus 1 ignored non-break-glass event, so a first run exercises the alert path end to end.

How to adapt it

  • Point audit_events_url and approvals_url at the live exports (cloud audit log export, identity provider audit export, ticketing system export, or approval table) and keep the JSON inputs for demos only. The event and record shapes stay the same, so the classifier is unchanged.
  • Tighten or loosen the account list per environment, and add a second alert target (for example a ticketing task) alongside the Slack webhook for unapproved use that needs a tracked incident.
  • Archive unapproved_details to a warehouse table on every run to build a break-glass use history for audits, instead of relying on the Slack channel as the record.
  • Add a post-incident step that disables or rotates a break-glass credential after an unapproved use is confirmed, once that action has its own approval gate.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.