Skip to content

Latest commit

Β 

History

288 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

bwsf

Test Release

bwsf (Bitwarden Secured Files) is a CLI tool that uses Bitwarden to manage .env* files and Terraform *.tfvars / *.tfvars.json.

Official site

🚨🚨 BREAKING CHANGE 🚨🚨

Changed CLI Name

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.

MIGRATE

Rename youre setting directory.

mv ~/.config/bwenv ~/.config/bwsf

Uninstall your current version, and re-install latest version.

brew uninstall bwenv
brew install bwsf

Multiple .env.enviroment files

From 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.

Overview

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

Motivation

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.

Requirements

bw command is needed to be installed your machine.

To install bw command, please read this document.

Homebrew: Need to install bwsf.

Machine OS

  • macOS
  • Linux
  • [Is planning] Windows

Installation

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.

Verify installation

bwsf -v
# bwsf version 0.15.0

Usage

Initial setup

bwsf setup

Set 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-envs

The 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 show

Pull managed files from Bitwarden host

cd /path/to/your_project
bwsf pull

bwsf 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).

Push managed files to Bitwarden host

cd /path/to/your_project
bwsf push

bwsf 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.

List projects in Bitwarden host

bwsf list

Prints project names from Bitwarden, one per line on stdout.

Clean local managed files

cd /path/to/your_project
bwsf clean

Removes local managed files after verifying the remote Bitwarden backup.

Uninstall

brew uninstall bwsf

FAQ

Q. 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.

Development

Requirement

Docker is needed to be installed your development machine.

Start up to dev

git clone https://github.com/b4moss/bwsf.git
cd bwsf
make run

License

MIT License

About

dotenv files management tool with Bitwarden

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages