bwsf (Bitwarden Secured Files) is a CLI tool that uses Bitwarden to manage .env* files and Terraform *.tfvars / *.tfvars.json.
From v0.11.0, bwenv is re-named as bwsf. This is cause some bwenv commands already existed. We decieded to change our CLI name to avoid confusing.
Rename youre setting directory.
mv ~/.config/bwenv ~/.config/bwsfUninstall your current version, and re-install latest version.
brew uninstall bwenv
brew install bwsfFrom v0.9.0, bwsf stores multiple enviroment .env files, like .env | .env.staging | .env.production.
Cause with this, stored data at Bitwarden Note item structure is changed.
Stored data before v0.8.0 is no compatiblity after v0.9.0.
We will not provide migration system.
bwsf manages project files in Bitwarden: .env*, *.tfvars, and *.tfvars.json (names containing .example are excluded).
Simple usage below:
| command | |
|---|---|
| bwsf setup | Configure Bitwarden host and account |
| bwsf config show | Show current local configuration |
| bwsf push | Push managed files to your Bitwarden host |
| bwsf pull | Pull managed files from your Bitwarden host |
| bwsf list | List stored projects at your Bitwarden host |
| bwsf clean | Remove local managed files after verifying Bitwarden backup |
We use Bitwarden as our password manager long time ago. Also, we store .env files our Bitwarden host, manage them as shell scripts. This project migrates our hand-maded shell scripts to modern CLI command with Go.
bw command is needed to be installed your machine.
To install bw command, please read this document.
Homebrew: Need to install bwsf.
- macOS
- Linux
- [Is planning] Windows
| OS | command |
|---|---|
| macOS | brew tap b4m-oss/tap && brew install bwsf |
| Linux | brew tap b4m-oss/tap && brew install bwsf |
Note: Linux requires Homebrew on Linux to be installed first.
bwsf -v
# bwsf version 0.15.0bwsf setupSet up your Bitwarden host and your account information.
By default, notes are stored in a Bitwarden folder named dotenvs. To use a different folder name:
bwsf setup --folder my-envsThe folder name is saved in ~/.config/bwsf/config.json and used by push / pull / list / clean. Changing the folder name does not move existing notes; move them manually in Bitwarden if needed.
Check saved values with:
bwsf config showcd /path/to/your_project
bwsf pullbwsf searches Bitwarden for a Note matching the current directory name. If it exists, managed files are written to the current directory. If a target file already exists locally, bwsf asks whether to overwrite it (per file).
cd /path/to/your_project
bwsf pushbwsf pushes managed files from the current directory to your Bitwarden host.
If a Note with the same project name already exists in the configured folder (default: dotenvs), bwsf updates it without an overwrite prompt.
bwsf listPrints project names from Bitwarden, one per line on stdout.
cd /path/to/your_project
bwsf cleanRemoves local managed files after verifying the remote Bitwarden backup.
brew uninstall bwsfQ. I don't have Bitwarden account.
To use bwsf, you need a Bitwarden account.
You can access to Bitwarden Cloud, sign up a account.
No fee, No credit card.
Q. I'm Bitwarden self hosted user.
Ofcourse, bwsf is available for Bitwarden self hosted users.
You can input your self hosted URL when initial setup.
Q. How does my .env file store at Bitwarden host?
Your managed files are converted to JSON syntax. bwsf creates a Bitwarden Note item and puts that JSON in the Note section.
Q. Where are my Bitwarden account info
bwsf stores your config data at ~/.config/bwsf/.
But, secure information (ex. password) is never stored.
Docker is needed to be installed your development machine.
git clone https://github.com/b4moss/bwsf.git
cd bwsf
make run