envirou

Manage your shell environment with Envirou

This project is maintained by sverrirab

Encrypted values

Envirou can store individual environment variable values encrypted at rest, in profiles and in .env files. Encrypted values look like enc:v1:... and are decrypted only when a profile or .env file is applied to your shell. Values are encrypted with AES-256-GCM using a key derived from your passphrase (PBKDF2-SHA256).

If you never use this feature, nothing changes for you.

Encrypting a value

envirou encrypt

The first use asks you to choose a passphrase of at least 12 characters and creates the key material file ~/.config/envirou/crypt.ini. Back this file up - encrypted values cannot be recovered without it (it does not contain your passphrase, only the salt used for key derivation).

You are then prompted (hidden input) for the value to encrypt, and the token is printed:

Paste this into your profile or .env file:
enc:v1:aFb0...

Paste the token as a normal value:

[profile:prod]
AWS_PROFILE=prod
DB_PASSWORD=enc:v1:aFb0...

or in a .env file:

DB_PASSWORD=enc:v1:aFb0...

For scripting, envirou encrypt --stdout VALUE prints the bare token to stdout (use with envirou, not the ev wrapper, and note that values passed as arguments end up in shell history).

envirou decrypt TOKEN decrypts a token and shows the plaintext, for verification.

Using encrypted profiles

Two modes:

Prompt per operation - just use profiles normally:

ev set prod
Envirou passphrase: ...
Profile prod enabled

Unlocked session - enter the passphrase once:

ev unlock
Envirou passphrase: ...
Unlocked - encrypted values now decrypt automatically.

ev set prod      # no prompt
ev set staging   # no prompt
ev lock          # forget the key again

ev unlock stores the derived key (not the passphrase) in the ENVIROU_KEY shell variable. While unlocked, profiles with encrypted values also show their active/inactive state correctly; while locked they display as inactive. Envirou masks ENVIROU_KEY in listings and excludes it from snapshots and diffs. The variable name remains visible so the unlocked state is not hidden, but its value is never displayed. Variable names containing encrypted profile values are also treated as sensitive automatically, so their plaintext remains masked after unlocking and decryption.

CI and non-interactive use

There is no terminal to prompt on in CI. Generate the key once on your machine and store it in your CI secret store:

envirou unlock --print-key

Then expose it to the job as ENVIROU_KEY. Decryption works without crypt.ini when ENVIROU_KEY is set.

Security notes