Harden secrets handling #9

Open
opened 2026-11-26 02:15:17 +01:00 by claude-bot · 0 comments

Secrets are the most valuable thing the pipeline touches. They must stay out of git, out of logs and readable only by the user that needs them.

Enterprise practice: central secret store, least-privilege access, no secrets in logs, one credential per purpose, rotation.

Steps

  • Real vault file and password live outside git on the ansible LXC; only vault.example.yml is committed
  • Separate SSH key per user and purpose (personal vs. runner)
  • Vault password file: owned by the user that runs playbooks, mode 0400, referenced via vault_password_file
  • Mark tasks that handle secrets with no_log: true and enable ansible-lint's opt-in no-log-password rule
  • Rendered .env files on docker: mode 0600
  • Never pass secrets as command-line arguments in workflows (they show up in process lists and logs); use files or environment variables
  • Write a short rotation runbook: vault password, runner SSH key, bot tokens

Tools

ansible-vault, ansible-lint, Gitea Actions secrets (for the few CI-only secrets).

Done when

No secret appears in git, job logs or world-readable files, and each credential can be rotated without touching the others.

Secrets are the most valuable thing the pipeline touches. They must stay out of git, out of logs and readable only by the user that needs them. **Enterprise practice:** central secret store, least-privilege access, no secrets in logs, one credential per purpose, rotation. ## Steps - [x] Real vault file and password live outside git on the `ansible` LXC; only `vault.example.yml` is committed - [x] Separate SSH key per user and purpose (personal vs. runner) - [ ] Vault password file: owned by the user that runs playbooks, mode `0400`, referenced via `vault_password_file` - [ ] Mark tasks that handle secrets with `no_log: true` and enable ansible-lint's opt-in `no-log-password` rule - [ ] Rendered `.env` files on `docker`: mode `0600` - [ ] Never pass secrets as command-line arguments in workflows (they show up in process lists and logs); use files or environment variables - [ ] Write a short rotation runbook: vault password, runner SSH key, bot tokens ## Tools ansible-vault, ansible-lint, Gitea Actions secrets (for the few CI-only secrets). ## Done when No secret appears in git, job logs or world-readable files, and each credential can be rotated without touching the others.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-ansible#9