Small python script to load bitwarden-store ssh keys into ssh-agent
Find a file
Joao Jacome 6035f80a11
Setting up PR/push workflows (#34)
* Setting up pull request/push workflows to run Black, MyPy and Flake8
* Fixing formatting
2023-01-14 16:29:39 +00:00
.github/workflows Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00
nix Added support to nix flakes (#33) 2023-01-14 15:29:27 +00:00
.gitignore Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00
bw_add_sshkeys.py Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00
LICENSE Adding a license 2021-10-22 10:50:46 +01:00
mypy.ini Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00
pyproject.toml Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00
README.md updadte README 2022-10-13 22:26:22 +08:00
setup.cfg Setting up PR/push workflows (#34) 2023-01-14 16:29:39 +00:00

Bitwarden SSH Agent

Requirements

  • You need to have the Bitwarden CLI tool installed and available in the $PATH as bw.
  • ssh-agent must be running in the current session.

What does it do?

Fetches SSH keys stored in Bitwarden vault and adds them to ssh-agent.

How to use it

  1. Run,
    ./bw_add_sshkeys.py
    
  2. Enter your Bitwarden credentials, if a Bitwarden vault session is not already set.
  3. (optional) Enter your SSH keys' passphrases if they're not stored in your Bitwarden.

Storing the keys in BitWarden

  1. Create a folder called ssh-agent (can be overridden on the command line).
  2. Add an new secure note to that folder.
  3. Upload the private key as an attachment.
  4. Add the custom field private (can be overridden on the command line), containing the file name of the private key attachment.
  5. (optional) If your key is encrypted with passphrase and you want it to decrypt automatically, save passphrase into custom field passphrase (field name can be overriden on the command line)
  6. Repeat steps 2-5 for each subsequent key

Command line overrides

  • --debug/-d - Show debug output
  • --foldername/-f - Folder name to use to search for SSH keys (default: ssh-agent)
  • --customfield/-c - Custom field name where private key filename is stored (default: private)
  • --passphrasefield/-p - Custom field name where passphrase for the key is stored (default: passphrase)
  • --session/-s - session key of bitwarden