Skip to content
Back to skills

Secrets Vault Manager

ASecurity

Generates HashiCorp Vault configs, plans secret rotation from an inventory, and flags suspicious access in Vault audit logs. Use when setting up Vault, scheduling rotation, or investigating secret access.

  • 1,271 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 29, 2026
ai-agentspythongobashkubernetesawsterraformapidatabasebackendsecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add borghei/Claude-Skills --skill secrets-vault-manager --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Secrets Vault Manager?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Secrets Vault Manager
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/borghei-secrets-vault-manager/badge)](https://www.skillsdirectory.com/skills/borghei-secrets-vault-manager)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: secrets-vault-manager
description: >
  Generates HashiCorp Vault configs, plans secret rotation from an inventory, and flags
  suspicious access in Vault audit logs. Use when setting up Vault, scheduling rotation,
  or investigating secret access.
license: MIT + Commons Clause
metadata:
  version: 1.1.0
  author: borghei
  category: engineering
  domain: secrets-management
  updated: 2026-11-08
  tags: [secrets, vault, hashicorp, rotation, audit, security]
---

# Secrets Vault Manager

The agent generates reviewed HashiCorp Vault configuration, turns a secrets inventory into a rotation schedule, and screens Vault audit logs for root-token use, off-hours access, bulk reads, failed authentication and sensitive paths. Nothing here talks to a live Vault: the tools read local files and print or write files.

## When to Use

- Setting up Vault for an environment: server config, secrets engines, auth methods and a policy.
- Building or reviewing a rotation schedule for an inventory of secrets.
- Investigating an exported audit log after an alert or as a periodic review.

## Clarify First

Before generating configs or plans, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.

- **Task:** config generation / rotation planning / audit-log analysis (selects the script and the entire workflow).
- **Environment & secrets engines:** e.g. production + kv/database/transit (`--env`, `--secrets-engines`; shapes the generated HCL).
- **Secrets inventory & classification:** Critical/High/Medium/Low per secret (drives rotation frequencies and the schedule).

Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.

## Quick Start

```bash
# Generate Vault configuration (text to stdout, or --output-dir DIR to write files)
python3 scripts/vault_config_generator.py --env production --secrets-engines kv,database,transit

# Plan rotation from your inventory (JSON: {"secrets": [{name, classification, secret_type, owner, last_rotated}]})
python3 scripts/rotation_planner.py --generate-sample > inventory.json     # starting template
python3 scripts/rotation_planner.py --inventory assets/sample_inventory_flawed.json --as-of 2026-12-01   # exit 1

# Screen a Vault audit log
python3 scripts/audit_log_analyzer.py --log-file assets/sample_audit_sound.log    # exit 0
python3 scripts/audit_log_analyzer.py --log-file assets/sample_audit_flawed.log   # exit 1
```

Real output excerpt (`rotation_planner.py --inventory assets/sample_inventory_flawed.json --as-of 2026-12-01`):

```
!!! stripe-api-key
     Last rotated: 2025-10-01 | Next: 2025-11-30 | Frequency: 60d
     Action: OVERDUE by 366 days. Rotate immediately.
!!! legacy-ftp-password
     Action: last_rotated '' is missing or not an ISO date. Rotate now, then record the real date (YYYY-MM-DD) in the inventory.
FIX 2 overdue secret(s): rotate them first
```

All three tools take `--format text|json` (`human` is a legacy alias for `text`). `--as-of YYYY-MM-DD` pins the planner's "today" so results are reproducible.

## Tools Overview

| Tool | Purpose | Key Flags |
|------|---------|-----------|
| `vault_config_generator.py` | Generate HashiCorp Vault configurations | `--env`, `--secrets-engines`, `--auth-methods` |
| `rotation_planner.py` | Plan and schedule secret rotation cycles | `--inventory`, `--generate-sample`, `--policy`, `--as-of`, `--filter-priority`, `--filter-owner`, `--format` |
| `audit_log_analyzer.py` | Analyze vault audit logs for anomalies | `--log-file`, `--bulk-threshold`, `--auth-threshold`, `--format` |

## Exit codes

| Tool | 0 | 1 | 2 |
|------|---|---|---|
| `vault_config_generator.py` | files written or printed | not used | unknown engine/auth method, empty list name |
| `rotation_planner.py` | nothing overdue | overdue secrets, or a missing/non-ISO `last_rotated` (reported as unknown, never guessed) | unreadable inventory, empty list, missing name, classification not critical/high/medium/low, bad `--policy` or `--as-of` |
| `audit_log_analyzer.py` | no alerts | alerts (critical ones marked in the report) | missing file, or no parseable Vault audit entries |

A log with nothing parseable is an error, not a clean result; skipped lines are counted on stderr. A quiet report is not proof of no misuse.

## Workflows

### Initial Vault Setup
1. Define environment and required secrets engines
2. Run `vault_config_generator.py` to generate HCL configs
3. Review and customize generated configurations
4. Apply via Terraform or Vault CLI

### Secret Rotation Planning
1. Create secrets inventory (JSON)
2. Run `rotation_planner.py` to generate schedule
3. Review rotation plan and adjust frequencies
4. Implement automated rotation where possible

### Audit Log Investigation
1. Export the file audit device log (one JSON entry per line).
2. Run `audit_log_analyzer.py`; read the skipped-line count on stderr, because skipped lines are events nobody screened.
3. Review each alert against change records and on-call notes.
4. Validation checkpoint: every high alert is explained or escalated; root-token use outside a documented break-glass event is an incident.

## Scope & Limitations

**In Scope:**
- HashiCorp Vault configuration files from `vault_config_generator.py`: server config, secrets engines (kv, database, transit, pki, aws, ssh), auth methods (approle, kubernetes, oidc, token, userpass) and a policy, per environment, with optional HA.
- Rotation schedules from a JSON secrets inventory with `rotation_planner.py`, including custom policies, priority and owner filters, and a sample inventory generator.
- Anomaly checks on Vault audit logs in JSON format with `audit_log_analyzer.py`: off-hours access, bulk reads, failed authentication, root token use and unusual paths.
- Classification, rotation and audit guidance in `references/secrets-management-guide.md`.

**Out of Scope:**
- Connecting to a running Vault server, applying configuration or rotating any secret. The scripts only read local files and print or write files.
- `.env` scaffolding, leaked-secret scanning and other secret stores (see `engineering/env-secrets-manager/`).
- Cloud KMS, IAM and secret-manager posture in live accounts (see `engineering/cloud-security/`).
- Provisioning Vault infrastructure with Terraform (see `engineering/terraform-patterns/`).

**Important Caveats:**
- Generated HCL is a starting template. It needs review for the real network, storage backend, TLS certificates and policy paths before use, and `--no-tls` is for development only.
- Rotation dates are only as accurate as the inventory. The planner does not discover secrets or check when they were last rotated.
- The log analyzer uses fixed rules and thresholds (`--bulk-threshold`, `--auth-threshold`, a 22:00-06:00 off-hours window applied to the logged timestamps). Alerts need investigation, and a quiet report does not show that no misuse took place.
- Vault features and engine options change between releases, so generated settings need checking against the documentation for the deployed version.

## Reference Documentation

- [Secrets Management Guide](references/secrets-management-guide.md) - Best practices, rotation policies, and compliance requirements

## Anti-Patterns

**Mistake:** Treating a quiet analyzer report as proof nothing happened.
**Why it matters:** The rules are fixed thresholds; misuse below them, or in lines the parser skipped, does not raise an alert.
**Instead:** Check the skipped-line count and the event totals, and sample the raw log for the paths that matter.

**Mistake:** Using the root token for routine work.
**Why it matters:** Root bypasses every policy and its use cannot be scoped or easily attributed.
**Instead:** Generate a root token only for break-glass tasks, revoke it straight after, and alert on any root-policy event.

**Mistake:** Applying generated HCL as is.
**Why it matters:** Storage, TLS, network and policy paths are placeholders for your environment; `--no-tls` configs leak secrets in transit.
**Instead:** Review every block against the deployed Vault version's documentation and apply through code review.

## Files

| File | Purpose |
|------|---------|
| `scripts/vault_config_generator.py` | Vault server, engine, auth and policy HCL per environment |
| `scripts/rotation_planner.py` | Rotation schedule from a JSON inventory |
| `scripts/audit_log_analyzer.py` | Rule-based screening of Vault audit logs |
| `assets/sample_audit_sound.log` | Ten business-hours reads by a service token; exits 0 |
| `assets/sample_audit_flawed.log` | Root-token reads at 03:00, failed logins, a policy change; exits 1 |
| `assets/malformed_audit.log` | Not an audit log; exits 2 |
| `assets/sample_inventory_sound.json`, `sample_inventory_flawed.json`, `malformed_inventory.json` | Rotation inventories (use `--as-of 2026-12-01`); exit 0, 1, 2 |
| `assets/rotation_policy.json` | Example `--policy` override |
| `assets/contract.json` | Runs checked by `scripts/skill_contract_check.py` |

Files in this skill

  • SKILL.md2.6 KB
  • references/secrets-management-guide.md2.8 KB
  • scripts/audit_log_analyzer.py13.8 KB
  • scripts/rotation_planner.py11.8 KB
  • scripts/vault_config_generator.py16.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.