Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Fetches SSH keys stored in Bitwarden vault and adds them to `ssh-agent`.
3. (optional) Enter your SSH keys' passphrases if they're not stored in your Bitwarden.

## Storing the keys in Bitwarden

### Option 1: Secret note
1. Create a folder called `ssh-agent` (can be overridden on the command line).
2. Add an new secure note to that folder.
3. Add the private key to the secure note:
Expand All @@ -32,6 +34,11 @@ Fetches SSH keys stored in Bitwarden vault and adds them to `ssh-agent`.
4. (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). You can create this field as `hidden` if you don't want the passphrase be displayed by default.
5. Repeat steps 2-4 for each subsequent key

### Option 2: Native Bitwarden SSH-Key
1. Create a folder called `ssh-agent` (can be overridden on the command line).
2. Add SSH-Key using [Bitwarden desktop, web app or browser extension](https://bitwarden.com/de-de/help/ssh-agent/#create-new-ssh-key)
3. Repeat step 2 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)_
Expand Down
3 changes: 3 additions & 0 deletions bw_add_sshkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def add_ssh_keys(


def fetch_key(session: str, item: dict[str, Any], keyname: str) -> str:
if "sshKey" in item:
return item["sshKey"]["privateKey"]

if "fields" in item and "attachments" in item:
logging.debug(
"Item %s has custom fields and attachments - searching for %s",
Expand Down