Manage your server secrets with Bitwarden
No Data
Manage your server secrets with Bitwarden
Get your secure environment variables from Bitwarden onto your server.
envwardensearches your Bitwarden vault for items matching a search criteria (defaults to 'envwarden'). Then it goes through all custom fields on every item found and make them available as envirnoment variables.
envwarden(e.g.
wget https://raw.githubusercontent.com/envwarden/envwarden/master/envwarden)
chmod +x envwarden && sudo cp envwarden /usr/local/binto make it executable and reachable
docker pull envwarden/envwarden
staging,
development,
production)
~/.envwardenif you wish
eval $(envwarden)to get your secrets
exported to your environment
.envfile using
envwarden --dotenv
Usage: envwarden [--help] [--search] [--dotenv] [--copy]To export environment variables, use:
eval $(envwarden)
To create an .env file, use:envwarden --dotenv > .env
Options: -h --help -s --search (optional) define the search term for bitwarden items (defaults to 'envwarden') -d --dotenv (optional) outputs to stdout in .env format -k --dotenv-docker (optional) outputs secrets to stdout in a "docker-friendly" .env format (no quotes) -c --copy (optional) copies all attachments on the item to a folder -g --github envs to github actions compliance
You can use ~/.envwarden to store your credentials (just email, or email:password)
You can provide your Bitwarden username and password using three methods:
# 1. Passing as environment to Docker docker run -ti -e [email protected] -e BW_PASSWORD=careful envwarden/envwarden2. Mapping your
.envwarden
filedocker run -ti -v $HOME/.envwarden:/root/.envwarden envwarden/envwarden
3. Waiting for
bw
to prompt for it for youdocker run -ti envwarden/envwarden
envwardenis a very simple bash script that wraps around the
bwCLI. You can inspect it to make sure it's secure and doesn't leak your secrets in any way. I tried to keep it as simple as possible, and also secure.
evalis generally dangerous to run, but the script makes an effort to protect against command injection.
--dotenvmight be a slightly safer option if your application can work with
.envfiles. Besides that, if you're worried about command injection from people who have write access to your secrets, you might have bigger problems to worry about, and perhaps
envwardenisn't for you :)
envwardenwould login and sync on every invocation. This isn't the fastest, but ideally you only need to run this when you bootstrap a new system, when you deploy, or when you need to refresh your secrets (in all cases, it probably makes sense to fetch the fresh secrets anyway).
envwardenis still experimental. Please use at your own risk. Feedback is welcome.
envwardenis not affiliated or connected to Bitwarden or its creators 8bit Solutions LLC in any way.