fix: decrypt SOPS through explicit custody into private output
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a12d13-27f2-7163-b8c0-f682af02772c
This commit is contained in:
parent
4cf26a9bc8
commit
681c5b0ea1
6 changed files with 499 additions and 27 deletions
28
Makefile
28
Makefile
|
|
@ -50,19 +50,8 @@ hooks-test: ## Test that the pre-commit hook blocks plaintext secrets
|
|||
@rm -rf sso-mfa/bootstrap/secrets/_hooktest
|
||||
|
||||
# ── SOPS / age ────────────────────────────────────────────────────────────────
|
||||
sops-setup: ## Legacy dev-local setup: copy age key to SOPS default path
|
||||
@mkdir -p ~/.config/sops/age
|
||||
@if [[ -f ~/.config/age/key.txt ]]; then \
|
||||
cp -n ~/.config/age/key.txt ~/.config/sops/age/keys.txt || true; \
|
||||
chmod 600 ~/.config/sops/age/keys.txt; \
|
||||
echo "✔ SOPS key ready at ~/.config/sops/age/keys.txt"; \
|
||||
elif [[ -f ~/.config/sops/age/keys.txt ]]; then \
|
||||
echo "✔ SOPS key already present at ~/.config/sops/age/keys.txt"; \
|
||||
else \
|
||||
echo "ERROR: age key not found at ~/.config/age/key.txt"; \
|
||||
echo " Generate one with: age-keygen -o ~/.config/age/key.txt"; \
|
||||
exit 1; \
|
||||
fi
|
||||
sops-setup: ## Validate the registered public age recipient; never install a private key
|
||||
@python3 sso-mfa/bootstrap/sops-private.py setup
|
||||
|
||||
sops-edit: ## Edit an encrypted file with SOPS: make sops-edit FILE=secrets/foo.yaml
|
||||
@[[ -n "$(FILE)" ]] || (echo "Usage: make sops-edit FILE=secrets/path/to/file.yaml"; exit 1)
|
||||
|
|
@ -73,9 +62,10 @@ sops-encrypt: ## Encrypt a file in place: make sops-encrypt FILE=secrets/foo.yam
|
|||
sops --encrypt --in-place $(FILE)
|
||||
@echo "✔ Encrypted $(FILE)"
|
||||
|
||||
sops-decrypt: ## Decrypt a file to stdout (never writes plaintext to disk): make sops-decrypt FILE=secrets/foo.yaml
|
||||
@[[ -n "$(FILE)" ]] || (echo "Usage: make sops-decrypt FILE=secrets/path/to/file.yaml"; exit 1)
|
||||
sops -d $(FILE)
|
||||
sops-decrypt: export NK_SOPS_FILE = $(FILE)
|
||||
sops-decrypt: export NK_SOPS_OUTPUT = $(OUTPUT)
|
||||
sops-decrypt: ## Decrypt age-only JSON/YAML to new private OUTPUT outside Git; explicit custody required
|
||||
@python3 sso-mfa/bootstrap/sops-private.py decrypt
|
||||
|
||||
sops-rotate: ## Rotate SOPS recipients after updating .sops.yaml: make sops-rotate FILE=secrets/foo.yaml
|
||||
@[[ -n "$(FILE)" ]] || (echo "Usage: make sops-rotate FILE=secrets/path/to/file.yaml"; exit 1)
|
||||
|
|
@ -123,18 +113,16 @@ creds-init: sops-setup hooks ## One-time setup: verify prerequisites, configure
|
|||
@command -v kubectl >/dev/null 2>&1 \
|
||||
&& echo "✔ kubectl found" \
|
||||
|| echo "WARN: kubectl not found (required for creds-apply/verify)"
|
||||
@test -f ~/.config/sops/age/keys.txt \
|
||||
|| (echo "ERROR: age key not found — run 'make sops-setup' after placing your key at ~/.config/age/key.txt"; exit 1)
|
||||
@echo ""
|
||||
@echo "✔ creds-init complete. Next: make creds-generate"
|
||||
|
||||
creds-generate: ## Generate all service secrets and print KeePassXC entry guide
|
||||
creds-generate: ## Generate private service files for public-recipient encryption
|
||||
@command -v openssl >/dev/null 2>&1 || (echo "ERROR: openssl not found"; exit 1)
|
||||
cd sso-mfa/bootstrap && bash gen-secrets.sh
|
||||
@sed -i "s|^generated_at: .*|generated_at: $$(date -Iseconds)|" sso-mfa/bootstrap/creds-state.yaml
|
||||
@echo ""
|
||||
@echo "State: generated_at updated in sso-mfa/bootstrap/creds-state.yaml"
|
||||
@echo "Next : enter values into KeePassXC, then set keepass_confirmed: true"
|
||||
@echo "Next : encrypt to the registered public recipient; never copy values into transcripts."
|
||||
@echo " Run 'make creds-bundle' to create an encrypted offsite backup."
|
||||
|
||||
creds-bundle: ## Age-encrypt the ops bundle for offsite storage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue