PowerShell helper script to temporarily download a SSH Key stored in Bitwarden to make a SSH connection.
Find a file
2021-09-11 16:53:49 -06:00
Images Initial commit 2021-09-11 16:37:49 -06:00
Connect-BitwardenSSH.ps1 Initial commit 2021-09-11 16:37:49 -06:00
LICENSE Initial commit 2021-09-11 16:31:34 -06:00
README.md Fixing README 2021-09-11 16:53:49 -06:00

Connect-BitwardenSSH

PowerShell helper script to temporarily download a SSH Key stored in Bitwarden to make a SSH connection.

Requirements

In the desired Bitwarden account, a item will need to be created to store the SSH key.

Bitwarden Example Item

An attachment can then be added of the private SSH key.

Bitwarden Example Attachment

Variables

Variable Required Default Description
SSHUser No [Environment]::UserName Username used for the SSH Connection
SSHDevice Yes Device to connect via SSH
SSHCommand No Extra parameters to be used in the SSH command - See OpenSSH docs for possible options
SearchString Yes The name of the item/attachment in Bitwarden for the SSH key

Example

Example 1

This will download the SSH key named "ssh-bw" from Bitwarden. You will be prompted for the device at runtime.

Connect-BitwardenSSH.ps1 -SearchString "ssh-bw"

Example 2

This will download the SSH key named "ssh-bw" from Bitwarden. The SSH connection will setup a port forward from the remote machine's RDP (3389) port to so it can be accessed via 3390 on the machine running the script.

Connect-BitwardenSSH.ps1 -SSHUser thale -SSHDevice 10.1.1.1 -SSHCommand "-N -L 3390:127.0.0.1:3389" -SearchString "ssh-bw" 

License

See LICENSE file for full license information.

Screenshots

Example Screenshot