Schedule icon
Script icon
If icon
Create icon
SlackIncomingWebhook icon
Log icon

HashiCorp Vault AppRole Secret-ID Expiration Sentinel

Monitor HashiCorp Vault AppRole secret-id expiration with Kestra. Query accessor metadata, track GitHub rotation issues, and alert SecOps on Slack.

Categories
CloudInfrastructure

Modern cloud architectures use HashiCorp Vault's AppRole authentication engine to authenticate automated machine workloads, Kubernetes pods, and CI/CD runners. While role-id identifiers are static, secret-id tokens carry a finite time-to-live (TTL). When secret-ids expire unnoticed, automated services fail authentication, causing critical application downtime and broken deployment pipelines. This blueprint queries HashiCorp Vault's AppRole accessor metadata API daily, identifies secret-ids approaching expiration thresholds, logs a prioritized GitHub rotation ticket, and alerts SecOps teams via Slack.

How it works

  1. daily_approle_hygiene_check (io.kestra.plugin.core.trigger.Schedule) initiates the audit daily at 08:00 UTC (shipped disabled for safe verification).
  2. probe_approle_secret_id (io.kestra.plugin.scripts.python.Script) interrogates the Vault REST API (POST /v1/auth/approle/role/{role}/secret-id-accessor/lookup) and inspects the remaining secret_id_ttl in seconds.
  3. branch_on_expiring_secret_id (io.kestra.plugin.core.flow.If) evaluates whether remaining hours are below the alert threshold (is_expiring == true):
    • then: Automatically files a GitHub tracking issue via create_security_rotation_issue (io.kestra.plugin.github.issues.Create) and alerts the Slack channel via alert_secops_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).
    • else: Emits an informational log entry (log_secret_id_healthy) confirming ample TTL remaining.
  4. log_audit_complete (io.kestra.plugin.core.log.Log) records the audit outcome.
  5. The errors block alerts Slack if Vault tokens expire or the cluster endpoint is unreachable.

What you get

  • Automated, scheduled auditing of machine authentication credentials.
  • Zero sudden production outages caused by expired AppRole tokens.
  • Consolidated GitHub incident tickets with accessor IDs, role names, and remaining hours.
  • Real-time Slack notifications with direct ticket hyperlinks.

Who it's for

  • DevSecOps and Platform Security Engineers managing enterprise Vault clusters.
  • Backend platform teams managing machine-to-machine authentication.
  • Site Reliability Engineers safeguarding credential renewal cycles.

Why orchestrate this with Kestra

Kestra coordinates external security API inspection, mathematical TTL conversion, conditional escalation, and chat alerting inside a unified, declarative pipeline. It injects Vault tokens securely, handles transient network retries, and maintains full execution audit logs without requiring custom scripts or cron daemons.

Prerequisites

  • A HashiCorp Vault cluster with the approle auth method enabled.
  • A Vault token with read / update permissions on auth/approle/role/+/secret-id-accessor/lookup.
  • A GitHub Personal Access Token with repository issue creation permissions.
  • A Slack incoming webhook URL for notifications.

Secrets

  • VAULT_TOKEN: Authentication token for querying HashiCorp Vault.
  • GITHUB_TOKEN: GitHub token used to open rotation issues.
  • SLACK_WEBHOOK: Incoming Webhook URL for security alerts.

Inputs

  • vault_address (STRING, default https://vault.internal.company.com:8200): HashiCorp Vault cluster URL.
  • role_name (STRING, default backend-api-production): Name of the audited Vault AppRole.
  • secret_id_accessor (STRING, default a1b2c3d4-e5f6-7890-abcd-ef1234567890): Non-sensitive accessor ID corresponding to the target secret-id.
  • ttl_hours_threshold (INT, default 72): Hours remaining threshold below which alerts are triggered.
  • github_repository (STRING, default my-org/security-operations): Target GitHub repository for logging incident issues.

Outputs

  • outputs.probe_approle_secret_id.vars.role_name: AppRole name audited.
  • outputs.probe_approle_secret_id.vars.hours_remaining: Calculated hours before secret-id expiration.
  • outputs.probe_approle_secret_id.vars.is_expiring: Boolean indicating whether TTL breached threshold.

Quick start

  1. Configure VAULT_TOKEN, GITHUB_TOKEN, and SLACK_WEBHOOK in your Kestra namespace.
  2. Import this flow and set vault_address, role_name, and secret_id_accessor to match a real AppRole credential.
  3. Run the flow manually to verify accessor lookup and Slack notification delivery.
  4. Enable the daily_approle_hygiene_check trigger for continuous credential hygiene monitoring.

How to extend

  • Add an automated secret-id rotation task (POST /v1/auth/approle/role/{role}/secret-id) gated behind operator approval.
  • Loop over multiple AppRole accessor IDs across several microservices using io.kestra.plugin.core.flow.ForEach.
  • Route urgent alerts to PagerDuty or Opsgenie if remaining TTL drops below 24 hours.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.