From 904a3216dfc85c516b2ddc641bb5e9c8d9a958e3 Mon Sep 17 00:00:00 2001 From: Sven Franken Date: Mon, 14 Jul 2025 09:56:40 +0200 Subject: [PATCH 1/2] Support native bitwarden ssh-key item type --- bw_add_sshkeys.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bw_add_sshkeys.py b/bw_add_sshkeys.py index 1414e9d..28c7fd1 100755 --- a/bw_add_sshkeys.py +++ b/bw_add_sshkeys.py @@ -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", From 66defe6a3c6310b6d7fb45a0121cbedf51788cde Mon Sep 17 00:00:00 2001 From: Sven Franken Date: Mon, 14 Jul 2025 10:14:35 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 9dad6b1..c4d0deb 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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)_