cryptenv

Crates.iocryptenv
lib.rscryptenv
version0.0.4
sourcesrc
created_at2021-10-10 02:59:14.197568
updated_at2021-10-10 11:25:18.577536
descriptionA transparent environment variables decryptor.
homepage
repositoryhttps://github.com/shosatojp/cryptenv
max_upload_size
id463001
size18,407
Sho Sato (shosatojp)

documentation

README

cryptenv

Rust

A transparent environment variables decryptor.

  • encrypt with AES-256-CBC

Install

cargo install cryptenv

Usage

Prepare encrypted environment variable

cryptenv --data <(echo -n "THIS IS TOP SECRET")

# password? # input password
# cryptenv://ndDGOi3AUgcB4XOiiimRmfY8lEvoBtYZF8mrappszvuhyjAqtqt2IxIf2iFXx+If

use this URI string for environment variable value.

# ~/.bashrc
TOP_SECRET=cryptenv://ndDGOi3AUgcB4XOiiimRmfY8lEvoBtYZF8mrappszvuhyjAqtqt2IxIf2iFXx+If

Run command with crypted secrets

cryptenv -- env | grep TOP_SECRET

# password? # input password
# TOP_SECRET=THIS IS TOP SECRET

Annoying to type password everytime?

  1. create this function on your ~/.bashrc

    function cryptenv-save() {
        local varname=CRYPTENV_PASSWORD
        if [ ! -v $varname ];then
            read -s -p 'password? ' $varname
            echo
            export $varname
        fi
        cryptenv --password-from $varname $@
    }
    
  2. then use cryptenv-save instead of cryptenv

    cryptenv-save -- env | grep TOP_SECRET
    
    • the password is required at first time
    • after that, the password stored in the env var of the shell
Commit count: 23

cargo fmt