2021-09-11 16:31:34 -06:00
# Connect-BitwardenSSH
PowerShell helper script to temporarily download a SSH Key stored in Bitwarden to make a SSH connection.
## Requirements
2021-09-11 16:37:49 -06:00
In the desired Bitwarden account, a item will need to be created to store the SSH key.
![Bitwarden Example Item ](Images/bitwarden-example.png?raw=true )
An attachment can then be added of the private SSH key.
![Bitwarden Example Attachment ](Images/bitwarden-example-attachments.png?raw=true )
2021-09-11 16:31:34 -06:00
## Variables
2021-09-11 16:37:49 -06:00
| 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 |
2021-09-11 16:31:34 -06:00
## Example
2021-09-11 16:37:49 -06:00
### Example 1
This will download the SSH key named "ssh-bw" from Bitwarden. You will be prompted for the device at runtime.
```powershell
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.
```powershell
Connect-BitwardenSSH.ps1 -SSHUser thale -SSHDevice 10.1.1.1 -SSHCommand "-N -L 3390:127.0.0.1:3389" -SearchString "ssh-bw"
```
2021-09-11 16:31:34 -06:00
## License
See LICENSE file for full license information.
## Screenshots
2021-09-11 16:37:49 -06:00
![Bitwarden Example Item ](Images/bitwarden-example-screenshot.png?raw=true )