Security
Secrets Encryption with SOPS and age
Quick Start
# 1. Generate an age key (one-time)
# 2. Get your public key
# Output: age1abc123...
# 3. Update .sops.yaml with your public key
# Replace the placeholder key in .sops.yaml with your actual public key
# 4. Encrypt a file
# 5. Edit encrypted files
Key Management
- Private key:
~/.config/sops/age/keys.txt— never commit this file. - Public key: Safe to share. It lives in
.sops.yaml. - Backup: Keep your private key in a password manager or a hardware security module.
Recovery
If you lose your age private key, follow these steps:
- Create a new key:
age-keygen -o ~/.config/sops/age/keys.txt - Re-encrypt all secrets with the new public key.
- Update
.sops.yamlwith the new public key.
Integration with Chezmoi
Chezmoi has built-in support for age encryption.
This encrypts the file in the source state. It uses the age key set in ~/.config/chezmoi/chezmoi.toml:
encryption = "age"
[age]
identity = "~/.config/sops/age/keys.txt"
recipient = "age1abc123..."