2020-07-02 10:11:59 -04:00
|
|
|
# bitwarden-helper-scripts
|
|
|
|
|
2020-07-02 10:29:54 -04:00
|
|
|
These are just some helper scripts I put together to help when using the official Bitwarden CLI.
|
|
|
|
|
|
|
|
## bwunlock.sh
|
|
|
|
|
|
|
|
Used to unlock a bitwarden vault and set the appropriate environment variables to keep the vault unlocked.
|
|
|
|
|
|
|
|
### Usage Instructions
|
|
|
|
|
|
|
|
1. Copy the file to a location of your choosing, I use `/home/$USER/scripts`
|
|
|
|
|
|
|
|
2. Set the following alias in your `~/.bashrc`:
|
|
|
|
```alias bw-unlock="source /home/$USER/scripts/bwunlock.sh"```
|
|
|
|
|
|
|
|
3. Source your bashrc or close and re-open your shell
|
|
|
|
|
|
|
|
4. Run `bw-unlock` and imput your Bitwarden Master Password when prompted
|
|
|
|
|
|
|
|
5. Run any Bitwarden command to ensure the script worked, like `bw list items`
|
2020-07-08 13:36:20 -04:00
|
|
|
|
|
|
|
## bw-ssh-uploader.sh
|
|
|
|
|
|
|
|
Used to upload a directory of ssh keys to bitwarden, placing public key in the note field, and private key as an attachment.
|
|
|
|
|
|
|
|
### Usage Instructions
|
|
|
|
|
|
|
|
1. Copy the file to a location of your choosing, I use `/home/$USER/scripts`
|
|
|
|
|
|
|
|
2. Mark it as executable
|
|
|
|
|
|
|
|
3. Run script like this:
|
|
|
|
```/home/$USER/scripts/bw-ssh-uploader.sh /path/to/directory/of/keys $COLLECTIONID $ORGID```
|
2020-07-08 15:19:57 -04:00
|
|
|
|
|
|
|
## bw-ssh.sh
|
|
|
|
|
|
|
|
Used to fetch a private key from bitwarden, add it to ssh-agent, and login to a host
|
|
|
|
|
|
|
|
### Usage Instructions
|
|
|
|
|
|
|
|
1. Copy the file to a location of your choosing, I use `/home/$USER/scripts`
|
|
|
|
|
|
|
|
2. Mark it as executable
|
|
|
|
|
|
|
|
3. Run the script like this:
|
|
|
|
```/home/$USER/scripts/bw-ssh.sh $KEYNAME $USERNAME $HOSTNAME```
|