This repository demonstrates an advanced secrets management system using Nix, integrating the passage
tool and generating rules for agenix
via secrets.nix
.
This system uses passage
for secret management and integrates with agenix
for encryption and decryption of sensitive data. It's designed to work seamlessly with Nix-based systems and provides a flexible, secure way to manage secrets across multiple vaults.
- Ensure you have Nix, direnv, devenv installed on your system.
- Clone this repository.
- Enter the development repl when you navigate to any of the vault directory:
daily-vault
orcritical-vault
.
Secrets are organized into vaults. Each vault is a directory containing:
store/:
Directory for storing encrypted secretsidentities/:
Directory for storing identity files.age-recipients:
File listing public keys of recipients
Use the passage command to add a new secret:
passage insert path/to/secret
To view a secret:
passage show path/to/secret
To see a list of all secrets:
dump-secrets-list
The system automatically watches for changes in the identities file and reencrypts secrets when necessary:
passage reencrypt
The secrets.nix file generates rules for agenix based on the vault structure. It automatically detects secret files and recipients across all vaults.
Development Shell Features The development shell provides several useful commands:
repl
: Start a Nix REPL with Nixpkgsroot-repl
: Start a Nix REPL with the current flakeqr
: Generate QR codesdump-secrets-list
: List all secrets paths
- Keep your identity files secure and backed up.
- Use strong, unique passwords for your secrets.
- Regularly audit your .age-recipients file to ensure only authorized keys have access.
Contributions are welcome! Please submit pull requests or open issues for any improvements or bug fixes.
Remember to keep your secrets secure and never commit unencrypted sensitive data to version control.
I first created an EdDSA public/private key pair to use for agenix
, and then I age
encrypted them to a set of three Yubikeys I use in my daily life. In this way, they're backed up and the key to read them is stored away in something secure I'm already using.
If I wanted, I could also probably store the encrypted keys as paper. But I prefer the Yubikey approach.